<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <!-- 需要定义一个animation -->
  <style media="screen">
    @keyframes aaa{
      0%{width:200px;height:200px;background:#CCC;font-size:14px;}
      25%{width:400px;height:200px;background:#CCC;font-size:14px;}
      50%{width:400px;height:400px;background:#CCC;font-size:14px;}
      75%{width:400px;height:400px;background:green;font-size:14px;}
      100%{width:400px;height:400px;background:green;font-size:33px;}
    }
    .box {
      width:200px;
      height:200px;
      font-size:14px;
      background:#CCC;
      margin:100px auto 0;
      transition:1s all ease;
    }
    .box:active{
      animation-name:aaa;
      animation-duration:5s;
      animation-timing-function:ease;
      <!-- 填充模式 -->
      animation-fill-mode:forwards;
      animation-delay:2s;
      <!-- 动画次数  可以设置为无限 infinite -->
      animation-iteration-count:5;
      /* 动画交替执行 */
      animation-direction: alternate;
      /* 动画暂停 */
      animation-play-state:paused;
      /* 结合js一起用 一般是通过添加一个类选择器，当事件发生 把选择器加上 */
    }
  </style>
</head>
<body>
<div class='box'>这是一些文字</div>
</body>
</html>
